/**
 * https://hihocoder.com/contest/hiho159/problem/1
 * 矩形找连续数字形成的区域的周长
 */
package hihocoder;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 区域周长 {

	static int[][] towards={{0,1},{1,0},{0,-1},{-1,0}};
	static boolean[][] visited;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int N=scanner.nextInt();
		int M=scanner.nextInt();
		int x=scanner.nextInt();
		int y=scanner.nextInt();
		int[][] A=new int[N][M];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < M; j++) {
				A[i][j]=scanner.nextInt();
			}
		}
		visited=new boolean[N][M];
		//用深度优先找到连续的区域
		System.out.println(DFS(A,x,y));
	}

	private static int DFS(int[][] a, int x, int y) {
		int ans=0;
		visited[x][y]=true;
		for (int[] integers : towards) {
			int newX=x+integers[0];
			int newY=y+integers[1];
			if(newX==a.length||newY==a[0].length||newX==-1||newY==-1){
				ans++;
			}else {
				if(!visited[newX][newY]){
					if(a[x][y]==a[newX][newY]){
						ans+=DFS(a,newX,newY);
					}else {
						ans++;
					}
				}
			}
		}
		return ans;
	}

}
